'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: category_entity.py
* @Time: 2025/9/22
* @All Rights Reserve By Brtc
'''
from pydantic import BaseModel, field_validator

from internal.exception.exception import FailException


class CategoryEntity(BaseModel):
    """分类实体"""
    category:str # 分类唯一标识
    name:str#分类名称
    icon:str#分类图标

    @field_validator("icon")
    def check_icon_extension(cls, value:str):
        """校验icon 的扩展名是不是svg"""
        if not value.endswith(".svg"):
            raise FailException("该分类图标不是 .svg格式")
        return value